package opera;

import Book.BookList;
import Book.book;

import java.util.Scanner;

/**
 * @Author: shark爱吃辣椒
 * @Date: 2022-19-14:36
 * @Description:
 */
public class Add implements IOpera{
    @Override
    public void work(BookList bookList) {
        System.out.println("增加图书");
        Scanner sca = new Scanner(System.in);

        System.out.println("请输入图书名：");
        String name = sca.nextLine();

        System.out.println("请输入图书作者：");
         sca = new Scanner(System.in);
        String author = sca.nextLine();

        System.out.println("请输入图书价格：");
         sca = new Scanner(System.in);
        int price = sca.nextInt();

        System.out.println("请输入图书类型：");
        sca = new Scanner(System.in);
        String type = sca.nextLine();

        book book = new book(name,author,price,type);
        int bookindex = bookList.getBooksnum();
        bookList.setBooks(book);
        bookList.setBooksnum(bookindex+1);


    }
}
